package com.drerp.servlet;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.drerp.RH.Colaborador;

public class ServletFoto extends HttpServlet{
	
		 /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

		/** Process the HTTP Get request */
		 public void doGet(HttpServletRequest request, HttpServletResponse
		  response) throws ServletException, IOException {
		  response.setContentType("image/png");
		  OutputStream out = response.getOutputStream();
		  long func_id = Long.parseLong(request.getParameter("id"));
		  Colaborador func = Colaborador.encontrarColaboradorPorId(func_id);
		  
		  out.write(func.getFoto());
		  out.flush();
		  out.close(); // Close stream
		 }
		
}
